<%@ page import="com.dingli.entity.Person" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>我的</title>
    <link rel="stylesheet" href="../CSS/common.css">
    <link rel="stylesheet" href="../CSS/mine.css">
    <script src="../JS/jquery-3.7.1.min.js"></script>
</head>
<body>
<div id="navBar">
    <div><a href="/index">首页</a></div>
    <div><a href="/order">订单</a></div>
    <div><a href="/mine">我的</a></div>
</div>
<div id="myInfo">
    <div id="bgImg">
        <h2><%= ((Person) session.getAttribute("user")).getAccount() %></h2>
    </div>
    <div id="manageInfo">
        <div id="left">
            <div onclick="showUpdateForm()">个人信息</div>
            <div onclick="showMyInfo()">修改信息</div>
            <div><a href="/logout">退出登录</a></div>
        </div>
        <div id="right">
            <div id="infoContent" class="content" style="display: none">
                <h3>修改信息</h3>
                <form id="updateForm" action="/updateUserInfo" method="POST" onsubmit="return confirm('确认提交？')">
                    <div class="form-group">
                        <label for="email">邮箱:</label>
                        <input type="email" id="email" name="email" placeholder="输入新的邮箱" required>
                    </div>
                    <div class="form-group">
                        <label for="oldPassword">旧密码:</label>
                        <input type="password" id="oldPassword" name="oldPassword" placeholder="输入旧的密码" required>
                    </div>
                    <div class="form-group">
                        <label for="newpassword">新密码:</label>
                        <input type="password" id="newpassword" name="newpassword" placeholder="输入新的密码" required>
                    </div>
                    <div class="form-group">
                        <label for="confirmPassword">确认密码:</label>
                        <input type="password" id="confirmPassword" name="confirmPassword" placeholder="确认密码" required>
                    </div>
                    <button type="submit" id="updateButton">保存修改</button>
                </form>
            </div>
            <div id="updateContent" class="content" style="display: none">
                <h3>基本信息</h3>
                <p>id: <strong><%= ((Person)session.getAttribute("user")).getId() %></strong></p>
                <p>用户名: <strong><%= ((Person)session.getAttribute("user")).getName() %></strong></p>
                <p>账号: <strong><%= ((Person)session.getAttribute("user")).getAccount() %></strong></p>
                <p>邮箱: <strong><%= ((Person)session.getAttribute("user")).getEmail() %></strong></p>
                <p>注册时间: <strong><%= ((Person)session.getAttribute("user")).getCreateTime() %></strong></p>
            </div>
        </div>
    </div>
</div>
<script src="../JS/mine.js"></script>
</body>
</html>

